enyo.kind({
    name: "MyApps.StoresMap",
    kind: enyo.VFlexBox,
    events: {
        onBack: "",
    },
    components: [    /**
     * Services
     */
    {
        name: "mapService",
        kind: "PalmService",
        service: "palm://com.palm.applicationManager/",
        method: "open",
        onSuccess: "gotMap",
        onFailure: "gotMapFailure",
    
    }, {
        flex: 1,
        name: "map",
        kind: "Map",
        credentials: "AsuRnAEKCnBbZ8CpIw7cJZqHeVjZSvpKbJedQzy0Th1Cr_BxhHvK8eL4-zQsiP_k",
        zoom: 4,
        //zaragoza in spain. Middle between France and Maroco
        latitude: 41.6545785963535,
        longitude: -0.886505618691444,
    
    }, ],
    
    
    gotMap: function(inSender, inResponse){
        console.log("map success ");
    },
    
    gotMapFailure: function(inSender, inResponse){
        console.log("map failure");
    },
    
    showOnMap: function(data){
        var bingmap = this.$.map.hasMap();
        
        var pushpinOptions = {
            icon: 'images/poi_custom.png'
        };
        
        for (x in data) {
            var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(data[x].shop.latitude, data[x].shop.longitude), null);
            bingmap.entities.push(pushpin);
        }
    }
    
    
});



